// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store'
import axios from 'axios'
import './assets/font/iconfont.css'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import 'animate.css'
// import Antd from 'ant-design-vue'
import moment from 'moment'
import Print from 'vue-print-nb'
// 引入echarts
import echarts from 'echarts'
import {
  addLabelAll,
  backToList,
  getSortOrder,
  previewFile,
  timeFormat,
  highlightSelectedRow,
  linkToDetail,
  getColDictId, filterParams, mesConfirm, confirmDelete, confirmOpen,
} from './utils'
import {checkPreviewSize, checkPreviewName} from './utils/checkPreview'
import {downByBlob, downloadErrorFile, downFile, exportTable, downByBlobLargeFile} from './utils/download'
import {dateConfig, startTimeStamp, endTimeStamp} from './utils/dateConfig'
import positiveInt from './directives/positiveInt'
import dialogDrag from './directives/dialogDrag'
import addPlaceholder from './directives/placeholder'
import tableScroll from './directives/tableScroll'
import btnPermission from './directives/btnPermission'
import component from './components'
import {arrayPolyfill} from './utils/Array.polyfill'

Vue.config.productionTip = false

// 全局引入element组件
// Vue.use(Antd)
Vue.use(ElementUI)
Vue.use(component)
Vue.use(Print)
Vue.config.productionTip = false

arrayPolyfill()

Vue.prototype.$echarts = echarts

Vue.prototype.addLabelAll = addLabelAll
Vue.prototype.backToList = backToList
Vue.prototype.confirmDelete = confirmDelete
Vue.prototype.confirmOpen = confirmOpen
Vue.prototype.mesConfirm = mesConfirm
Vue.prototype.$getSortOrder = getSortOrder
Vue.prototype.$previewFile = previewFile
Vue.prototype.$dateConfig = dateConfig
Vue.prototype.$startTimeStamp = startTimeStamp
Vue.prototype.$endTimeStamp = endTimeStamp
Vue.prototype.$checkPreviewName = checkPreviewName
Vue.prototype.$checkPreviewSize = checkPreviewSize
Vue.prototype.$getColDictId = getColDictId
Vue.prototype.$filterParams = filterParams
Vue.prototype.$downFile = downFile
Vue.prototype.$exportTable = exportTable
Vue.prototype.$downByBlob = downByBlob
Vue.prototype.$downByBlobLargeFile = downByBlobLargeFile
Vue.prototype.$downloadErrorFile = downloadErrorFile
Vue.prototype.$highlightSelectedRow = highlightSelectedRow
Vue.prototype.$axios = axios
Vue.prototype.$linkToDetail = linkToDetail
Vue.prototype.tableMaxHeight = 660 // 指定为数字是因为有些地方要做计算 列表页面，表格默认最大高度，
Vue.prototype.tableCascadeHeight = 450 // 存在级联的列表页面，表格默认最大高度，
Vue.prototype.openDelay = 300 // 图标提示延迟时间为300ms
Vue.prototype.defaultFileLevel = 'ID_FSL_Public' // 设置上传文件的默认文件密级
Vue.prototype.moment = moment
moment.locale('zh-cn')

Vue.directive('positive-int', {
  update: (el, binding) => positiveInt(el, binding)
})
Vue.directive('dialogDrag', {
  bind: (el, binding, vnode, oldVnode) => dialogDrag(el, binding, vnode, oldVnode)
})
Vue.directive('add-placeholder', {
  update: (el, binding) => addPlaceholder(el, binding)
})
Vue.directive('table-scroll', {
  update: (el, binding) => tableScroll(el, binding)
})

Vue.directive('btn-permission', {
  bind: btnPermission
})

// 日期格式化
Vue.filter('timeFormat', (time, formatter) => timeFormat(time, formatter))

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  components: {App},
  template: '<App/>'
})
